package learning.maxent.inference;

import learning.maxent.model.Model;

public class Inference {

	private Model model;
	
	public Inference(Model model) {
		this.model = model;
	}
	
	public Parse parse(IParseScorer parseScorer) {
		
		int bestState = -1;
		float bestScore = Float.NEGATIVE_INFINITY;
		
		for (int s=0; s < model.numStates; s++) {
			float score = parseScorer.score(s);
			if (score > bestScore) {
				bestScore = score;
				bestState = s;
			}
		}
			
		return new Parse(bestState, bestScore);
	}
}
